package cz.ujep.ki.emap;

import android.content.BroadcastReceiver;
import android.content.Context;
import android.content.Intent;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;

public class NetworkChangeReceiver extends BroadcastReceiver {

	@Override
	public void onReceive(Context context, Intent intent) {
		//NetworkInfo info = (NetworkInfo)intent.getParcelableExtra("EXTRA_NETWORK_INFO");
		ConnectivityManager mng = 
				(ConnectivityManager)context.getSystemService(Context.CONNECTIVITY_SERVICE);
		NetworkInfo info = mng.getActiveNetworkInfo();
		if(info !=null && info.isConnectedOrConnecting()) {
			Intent sintent = new Intent(context, DeliverService.class);
			context.startService(sintent);
		}
	}

}
